<template>
  <div>
    <!-- 搜索表单 -->
    <el-form :inline="true" size="mini">
      <el-form-item label="课程分类">
        <el-cascader
          v-model="form.course_classify_id"
          :options="courseCate"></el-cascader>
      </el-form-item>
      <el-form-item label="课程类型">
        <el-select>
          <el-option
            v-for="(v,k) in courseType"
            :key="k"
            :value="k"
            :label="v"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="课程状态">
        <el-select v-model="form.status">
          <el-option label="已上架" value="1"></el-option>
          <el-option label="已下架" value="2"></el-option>
          <el-option label="待上架" value="3"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="创建时间">

      </el-form-item>
      <el-form-item label="课程名称">
        <el-input v-model="form.keywords" placeholder="请输入课程名称关键字"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button>搜索</el-button>
        <el-button>重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  data() {
    return {
      form: {
        course_classify_id: 0,
        course_type: '',
        keywords: '',
        keywords_type: '',
        limit: 10,
        page: 1,
        start_created_at: '',
        finish_created_at: '',
        status: '',
        teacher_id: ''
      },
      // 二级分类
      courseCate: [],
      // 课程类型
      courseType: {}
    }
  },
  created() {
    // 获取二级分类
    axios.get('/course/classify').then(res => {
      if (res) {
        this.courseCate = res.data
      }
    })
    // 获取类型
    axios.get('/config/other_setting').then(res => {
      if (res) {
        this.courseType = res.data.course_name
      }
    })
  }
}
</script>
